package reflect;

import reflect.annotation.AutoRunClass;

import java.lang.annotation.Annotation;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个类");
        String className = scanner.nextLine();
        Class cls = Class.forName(className);
        boolean flag = cls.isAnnotationPresent(AutoRunClass.class);
        if(flag){
            System.out.println("被标注");
            Object obj = cls.newInstance();
            System.out.println(obj);
        }else{
            System.out.println("未被标注");
        }
    }
}
